package com.ukao.steward.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.ukao.steward.util.CheckUtils;

import java.util.List;

/**
 * Created by ukaodev on 2017/10/14.
 */

public class SearchUserBean  extends  BaseBean<SearchUserBean> implements Parcelable {
        /**
         * cardName : 银牌会员卡
         * cardLevel : 3
         * isBinding : 1
         * sex : 1
         * wxNickname : null
         * groupList : {"id":-1,"mercId":null,"cityId":null,"name":"默认分组","cnt":null,"createBy":null,"createTime":null,"updateBy":null,"updateTime":null}
         * userId : 81
         * headimgPath : null
         * cardNo : 287391623
         * tagList : [{"id":88,"mercId":1,"cityId":1,"name":"32323232","cnt":1,"createBy":2,"createTime":1516674165000,"updateBy":2,"updateTime":1521619518000},{"id":84,"mercId":1,"cityId":1,"name":"星汇云锦店","cnt":0,"createBy":2,"createTime":1516245634000,"updateBy":2,"updateTime":1521619518000}]
         * balance : 1020160
         * cardDiscountName : null
         * phone : 15573583595
         * addressList : [{"sex":1,"phone":"15573583595","def":1,"regionalDesc":"北京 东城 东城区","name":"gugh","desc":" yyhh ","id":72}]
         * cardId : 34
         * name : gugh
         * cardDiscount : null
         * isRegister : 1
         */

        private   String  birthday;
        private String cardName;
        private String cardLevel;
        private int isBinding;
        private int  sex;
        private  int  point;
        private  int   couponCnt;
        private String wxNickname;
        private GroupListBean groupList;
        private String userId;
        private String headimgPath;
        private String cardNo;
        private  String  rfidNo;
        private   int  wxId;
        private int balance;
        private String cardDiscountName;
        private String phone;
        private int cardId;
        private String name;
        private int  cardDiscount;
        private int isRegister;
        private List<TagListBean> tagList;
        private List<AddressListBean> addressList;
        private    userGroupBean    userGroup;
        private  int    verifyPhone;


    public int getWxId() {
        return wxId;
    }

    public int getCouponCnt() {
        return couponCnt;
    }

    public String getBirthday() {
        return birthday;
    }

    public int getVerifyPhone() {
        return verifyPhone;
    }

    public userGroupBean  getUserGroup() {
        return userGroup;
    }

    public int getPoint() {
        return point;
    }

    public String getCardName() {
            return cardName;
        }

        public void setCardName(String cardName) {
            this.cardName = cardName;
        }

        public String getCardLevel() {
            return cardLevel;
        }

        public void setCardLevel(String cardLevel) {
            this.cardLevel = cardLevel;
        }

        public boolean getIsBinding() {
            boolean  isBindings=false;
            if ( isBinding==1){
                isBindings=true;
            }
            return isBindings;
        }

        public void setIsBinding(int isBinding) {
            this.isBinding = isBinding;
        }

        public String  getSex() {
            String msex = "";
            switch (sex) {
                case 1:
                    msex = "男";
                    break;
                case 2:
                    msex = "女";
                    break;
                case 0:
                  //  msex = "未知";
                    break;


            }
            return msex;
        }

        public void setSex(int sex) {
            this.sex = sex;
        }

        public Object getWxNickname() {
            return wxNickname;
        }

        public void setWxNickname(String wxNickname) {
            this.wxNickname = wxNickname;
        }

        public GroupListBean getGroupList() {
            return groupList;
        }

        public void setGroupList(GroupListBean groupList) {
            this.groupList = groupList;
        }

        public String getUserId() {
            return userId;
        }

        public void setUserId(String userId) {
            this.userId = userId;
        }

        public String getHeadimgPath() {
            return headimgPath;
        }

        public void setHeadimgPath(String headimgPath) {
            this.headimgPath = headimgPath;
        }

        public String getCardNo() {
            return cardNo;
        }
    public String getRfidNo() {
        return rfidNo;
    }
        public void setCardNo(String cardNo) {
            this.cardNo = cardNo;
        }

        public int getBalance() {
            return balance;
        }

        public void setBalance(int balance) {
            this.balance = balance;
        }

    public String getCardDiscountName() {
        if (CheckUtils.isEmpty(cardDiscountName)){
            cardDiscountName="无折扣";
        }else{
            if (!cardDiscountName.contains("折")){
                cardDiscountName=cardDiscountName+"折";
            }

        }


        return  cardDiscountName;
    }

    public void setCardDiscountName(String cardDiscountName) {
            this.cardDiscountName = cardDiscountName;
        }

        public String getPhone() {
            return phone;
        }

        public void setPhone(String phone) {
            this.phone = phone;
        }

        public int getCardId() {
            return cardId;
        }

        public void setCardId(int cardId) {
            this.cardId = cardId;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getCardDiscount() {
            return cardDiscount;
        }

        public void setCardDiscount(int  cardDiscount) {
            this.cardDiscount = cardDiscount;
        }

        public int getIsRegister() {
            return isRegister;
        }

        public void setIsRegister(int isRegister) {
            this.isRegister = isRegister;
        }

        public List<TagListBean> getTagList() {
            return tagList;
        }

        public void setTagList(List<TagListBean> tagList) {
            this.tagList = tagList;
        }

        public List<AddressListBean> getAddressList() {
            return addressList;
        }

        public void setAddressList(List<AddressListBean> addressList) {
            this.addressList = addressList;
        }

        public static class GroupListBean implements Parcelable {


            /**
             * id : -1
             * mercId : null
             * cityId : null
             * name : 默认分组
             * cnt : null
             * createBy : null
             * createTime : null
             * updateBy : null
             * updateTime : null
             */
            private int id;
            private String mercId;
            private String cityId;
            private String name;
            private String cnt;
            private String createBy;
            private long createTime;
            private String updateBy;
            private String updateTime;

            public int getId() {
                return id;
            }

            public void setId(int id) {
                this.id = id;
            }

            public Object getMercId() {
                return mercId;
            }

            public void setMercId(String mercId) {
                this.mercId = mercId;
            }

            public Object getCityId() {
                return cityId;
            }

            public void setCityId(String cityId) {
                this.cityId = cityId;
            }

            public String getName() {
                return name;
            }

            public void setName(String name) {
                this.name = name;
            }

            public Object getCnt() {
                return cnt;
            }

            public void setCnt(String cnt) {
                this.cnt = cnt;
            }

            public Object getCreateBy() {
                return createBy;
            }

            public void setCreateBy(String createBy) {
                this.createBy = createBy;
            }

            public Object getCreateTime() {
                return createTime;
            }

            public void setCreateTime(long createTime) {
                this.createTime = createTime;
            }

            public Object getUpdateBy() {
                return updateBy;
            }

            public void setUpdateBy(String updateBy) {
                this.updateBy = updateBy;
            }

            public Object getUpdateTime() {
                return updateTime;
            }

            public void setUpdateTime(String updateTime) {
                this.updateTime = updateTime;
            }


            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeInt(this.id);
                dest.writeString(this.mercId);
                dest.writeString(this.cityId);
                dest.writeString(this.name);
                dest.writeString(this.cnt);
                dest.writeString(this.createBy);
                dest.writeLong(this.createTime);
                dest.writeString(this.updateBy);
                dest.writeString(this.updateTime);
            }

            public GroupListBean() {
            }

            protected GroupListBean(Parcel in) {
                this.id = in.readInt();
                this.mercId = in.readString();
                this.cityId = in.readString();
                this.name = in.readString();
                this.cnt = in.readString();
                this.createBy = in.readString();
                this.createTime = in.readLong();
                this.updateBy = in.readString();
                this.updateTime = in.readString();
            }

            public static final Creator<GroupListBean> CREATOR = new Creator<GroupListBean>() {
                @Override
                public GroupListBean createFromParcel(Parcel source) {
                    return new GroupListBean(source);
                }

                @Override
                public GroupListBean[] newArray(int size) {
                    return new GroupListBean[size];
                }
            };
        }

    public static class userGroupBean implements Parcelable {
        private  String  name;

        public String getName() {
            return CheckUtils.isEmptyString(name);
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.name);
        }

        public userGroupBean() {
        }

        protected userGroupBean(Parcel in) {
            this.name = in.readString();
        }

        public static final Creator<userGroupBean> CREATOR = new Creator<userGroupBean>() {
            @Override
            public userGroupBean createFromParcel(Parcel source) {
                return new userGroupBean(source);
            }

            @Override
            public userGroupBean[] newArray(int size) {
                return new userGroupBean[size];
            }
        };
    }

        public static class TagListBean implements Parcelable {
            /**
             * id : 88
             * mercId : 1
             * cityId : 1
             * name : 32323232
             * cnt : 1
             * createBy : 2
             * createTime : 1516674165000
             * updateBy : 2
             * updateTime : 1521619518000
             */

            private int id;
            private int mercId;
            private int cityId;
            private String name;
            private int cnt;
            private int createBy;
            private long createTime;
            private int updateBy;
            private long updateTime;

            public int getId() {
                return id;
            }

            public void setId(int id) {
                this.id = id;
            }

            public int getMercId() {
                return mercId;
            }

            public void setMercId(int mercId) {
                this.mercId = mercId;
            }

            public int getCityId() {
                return cityId;
            }

            public void setCityId(int cityId) {
                this.cityId = cityId;
            }

            public String getName() {
                return name;
            }

            public void setName(String name) {
                this.name = name;
            }

            public int getCnt() {
                return cnt;
            }

            public void setCnt(int cnt) {
                this.cnt = cnt;
            }

            public int getCreateBy() {
                return createBy;
            }

            public void setCreateBy(int createBy) {
                this.createBy = createBy;
            }

            public long getCreateTime() {
                return createTime;
            }

            public void setCreateTime(long createTime) {
                this.createTime = createTime;
            }

            public int getUpdateBy() {
                return updateBy;
            }

            public void setUpdateBy(int updateBy) {
                this.updateBy = updateBy;
            }

            public long getUpdateTime() {
                return updateTime;
            }

            public void setUpdateTime(long updateTime) {
                this.updateTime = updateTime;
            }


            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeInt(this.id);
                dest.writeInt(this.mercId);
                dest.writeInt(this.cityId);
                dest.writeString(this.name);
                dest.writeInt(this.cnt);
                dest.writeInt(this.createBy);
                dest.writeLong(this.createTime);
                dest.writeInt(this.updateBy);
                dest.writeLong(this.updateTime);
            }

            public TagListBean() {
            }

            protected TagListBean(Parcel in) {
                this.id = in.readInt();
                this.mercId = in.readInt();
                this.cityId = in.readInt();
                this.name = in.readString();
                this.cnt = in.readInt();
                this.createBy = in.readInt();
                this.createTime = in.readLong();
                this.updateBy = in.readInt();
                this.updateTime = in.readLong();
            }

            public static final Creator<TagListBean> CREATOR = new Creator<TagListBean>() {
                @Override
                public TagListBean createFromParcel(Parcel source) {
                    return new TagListBean(source);
                }

                @Override
                public TagListBean[] newArray(int size) {
                    return new TagListBean[size];
                }
            };
        }

        public static class AddressListBean  extends  BaseBean<AddressListBean>   implements Parcelable {
            /**
             * sex : 1
             * phone : 15573583595
             * def : 1
             * regionalDesc : 北京 东城 东城区
             * name : gugh
             * desc :  yyhh
             * id : 72
             */

            private int sex;
            private String phone;
            private int def;
            private String regionalDesc;
            private String name;
            private String desc;
            private String id;
            private  String   detail;

            public String getDetail() {
                return detail;
            }

            public int getSex() {
                return sex;
            }

            public void setSex(int sex) {
                this.sex = sex;
            }

            public String getPhone() {
                return phone;
            }

            public void setPhone(String phone) {
                this.phone = phone;
            }

            public int getDef() {
                return def;
            }

            public void setDef(int def) {
                this.def = def;
            }

            public String getRegionalDesc() {
                return CheckUtils.isEmptyString(regionalDesc);
            }

            public void setRegionalDesc(String regionalDesc) {
                this.regionalDesc = regionalDesc;
            }

            public String getName() {
                return CheckUtils.isEmptyString(name);
            }

            public void setName(String name) {
                this.name = name;
            }

            public String getDesc() {

                return !CheckUtils.isEmpty(desc) ? desc : CheckUtils.isEmptyString(getDetail());
            }

            public void setDesc(String desc) {
                this.desc = desc;
            }

            public String getId() {
                return id;
            }

            public void setId(String id) {
                this.id = id;
            }

            public AddressListBean() {
            }


            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeInt(this.sex);
                dest.writeString(this.phone);
                dest.writeInt(this.def);
                dest.writeString(this.regionalDesc);
                dest.writeString(this.name);
                dest.writeString(this.desc);
                dest.writeString(this.id);
                dest.writeString(this.detail);
            }

            protected AddressListBean(Parcel in) {
                this.sex = in.readInt();
                this.phone = in.readString();
                this.def = in.readInt();
                this.regionalDesc = in.readString();
                this.name = in.readString();
                this.desc = in.readString();
                this.id = in.readString();
                this.detail = in.readString();
            }

            public static final Creator<AddressListBean> CREATOR = new Creator<AddressListBean>() {
                @Override
                public AddressListBean createFromParcel(Parcel source) {
                    return new AddressListBean(source);
                }

                @Override
                public AddressListBean[] newArray(int size) {
                    return new AddressListBean[size];
                }
            };
        }


    public SearchUserBean() {
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.birthday);
        dest.writeString(this.cardName);
        dest.writeString(this.cardLevel);
        dest.writeInt(this.isBinding);
        dest.writeInt(this.sex);
        dest.writeInt(this.point);
        dest.writeInt(this.couponCnt);
        dest.writeString(this.wxNickname);
        dest.writeParcelable(this.groupList, flags);
        dest.writeString(this.userId);
        dest.writeString(this.headimgPath);
        dest.writeString(this.cardNo);
        dest.writeString(this.rfidNo);
        dest.writeInt(this.wxId);
        dest.writeInt(this.balance);
        dest.writeString(this.cardDiscountName);
        dest.writeString(this.phone);
        dest.writeInt(this.cardId);
        dest.writeString(this.name);
        dest.writeInt(this.cardDiscount);
        dest.writeInt(this.isRegister);
        dest.writeTypedList(this.tagList);
        dest.writeTypedList(this.addressList);
        dest.writeParcelable(this.userGroup, flags);
        dest.writeInt(this.verifyPhone);
    }

    protected SearchUserBean(Parcel in) {
        this.birthday = in.readString();
        this.cardName = in.readString();
        this.cardLevel = in.readString();
        this.isBinding = in.readInt();
        this.sex = in.readInt();
        this.point = in.readInt();
        this.couponCnt = in.readInt();
        this.wxNickname = in.readString();
        this.groupList = in.readParcelable(GroupListBean.class.getClassLoader());
        this.userId = in.readString();
        this.headimgPath = in.readString();
        this.cardNo = in.readString();
        this.rfidNo = in.readString();
        this.wxId = in.readInt();
        this.balance = in.readInt();
        this.cardDiscountName = in.readString();
        this.phone = in.readString();
        this.cardId = in.readInt();
        this.name = in.readString();
        this.cardDiscount = in.readInt();
        this.isRegister = in.readInt();
        this.tagList = in.createTypedArrayList(TagListBean.CREATOR);
        this.addressList = in.createTypedArrayList(AddressListBean.CREATOR);
        this.userGroup = in.readParcelable(userGroupBean.class.getClassLoader());
        this.verifyPhone = in.readInt();
    }

    public static final Creator<SearchUserBean> CREATOR = new Creator<SearchUserBean>() {
        @Override
        public SearchUserBean createFromParcel(Parcel source) {
            return new SearchUserBean(source);
        }

        @Override
        public SearchUserBean[] newArray(int size) {
            return new SearchUserBean[size];
        }
    };
}
